2007-06-26 Johan Dahlin <jdahlin@async.com.br>
+ * gtk/gtkbuilder.h (enum):
+ * gtk/gtkbuilderparser.c (end_element):
+ * tests/buildertest.c (test_parser):
+ Set an error if we encounter properties without values set
+ (#451303, Philip Withnall)
+
* demos/gtk-demo/builder.c (do_builder): Connect the
destroy signal in the example instead of the ui file.
Also set the screen and title of the window.
GTK_BUILDER_ERROR_UNHANDLED_TAG,
GTK_BUILDER_ERROR_MISSING_ATTRIBUTE,
GTK_BUILDER_ERROR_INVALID_ATTRIBUTE,
- GTK_BUILDER_ERROR_INVALID_TAG
+ GTK_BUILDER_ERROR_INVALID_TAG,
+ GTK_BUILDER_ERROR_MISSING_PROPERTY_VALUE
} GtkBuilderError;
GQuark gtk_builder_error_quark (void);
line_number, char_number, tag);
}
+static void
+error_missing_property_value (ParserData *data,
+ GError **error)
+{
+ gint line_number, char_number;
+
+ g_markup_parse_context_get_position (data->ctx,
+ &line_number,
+ &char_number);
+
+ g_set_error (error,
+ GTK_BUILDER_ERROR,
+ GTK_BUILDER_ERROR_MISSING_PROPERTY_VALUE,
+ "%s:%d:%d <property> must have a value set",
+ data->filename,
+ line_number, char_number);
+}
+
static GObject *
builder_construct (ParserData *data,
ObjectInfo *object_info)
PropertyInfo *prop_info = state_pop_info (data, PropertyInfo);
CommonInfo *info = state_peek_info (data, CommonInfo);
+ if (!prop_info->data)
+ {
+ error_missing_property_value (data, error);
+ return;
+ }
+
/* Normal properties */
if (strcmp (info->tag.name, "object") == 0)
{
g_return_val_if_fail (strcmp (error->message, "<input>:1:74 'object' is not a valid tag here") == 0, FALSE);
g_error_free (error);
+ error = NULL;
+ gtk_builder_add_from_string (builder, "<interface><object class=\"GtkWindow\" id=\"a\"><property name=\"type\"/></object></interface>", -1, &error);
+ g_assert (error != NULL);
+ g_return_val_if_fail (strcmp (error->message, "<input>:1:67 <property> must have a value set") == 0, FALSE);
+ g_error_free (error);
+
+
return TRUE;
}